package com.uuah.server.config.spring.parsers.delegate;

import java.util.Map;

import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;

import com.uuah.server.config.spring.parsers.IUuahDefinitionParser;
import com.uuah.server.config.spring.parsers.IUuahDefinitionParserConfiguration;
import com.uuah.server.config.spring.parsers.PostProcessor;
import com.uuah.server.config.spring.parsers.PreProcessor;
import com.uuah.server.config.spring.parsers.assembly.configuration.IValueMap;

/**
 * Support for extending a
 * {@link com.uuah.server.config.spring.parsers.UuahDefinitionParser} without needing to
 * subclass.
 */
public abstract class AbstractPluggableDelegate implements IUuahDefinitionParser {

	private IUuahDefinitionParser delegate;

	public AbstractPluggableDelegate(IUuahDefinitionParser delegate) {
		this.delegate = delegate;
	}

	public AbstractBeanDefinition uuahParse(Element element,
			ParserContext parserContext) {
		return delegate.uuahParse(element, parserContext);
	}

	public IUuahDefinitionParserConfiguration registerPreProcessor(
			PreProcessor preProcessor) {
		delegate.registerPreProcessor(preProcessor);
		return this;
	}

	public IUuahDefinitionParserConfiguration registerPostProcessor(
			PostProcessor postProcessor) {
		delegate.registerPostProcessor(postProcessor);
		return this;
	}

	public IUuahDefinitionParserConfiguration addReference(String propertyName) {
		delegate.addReference(propertyName);
		return this;
	}

	public IUuahDefinitionParserConfiguration addMapping(String propertyName,
			Map mappings) {
		delegate.addMapping(propertyName, mappings);
		return this;
	}

	public IUuahDefinitionParserConfiguration addMapping(String propertyName,
			String mappings) {
		delegate.addMapping(propertyName, mappings);
		return this;
	}

	public IUuahDefinitionParserConfiguration addMapping(String propertyName,
			IValueMap mappings) {
		delegate.addMapping(propertyName, mappings);
		return this;
	}

	public IUuahDefinitionParserConfiguration addAlias(String alias,
			String propertyName) {
		delegate.addAlias(alias, propertyName);
		return this;
	}

	public IUuahDefinitionParserConfiguration addCollection(String propertyName) {
		delegate.addCollection(propertyName);
		return this;
	}

	public IUuahDefinitionParserConfiguration addIgnored(String propertyName) {
		delegate.addIgnored(propertyName);
		return this;
	}

	public IUuahDefinitionParserConfiguration removeIgnored(String propertyName) {
		delegate.removeIgnored(propertyName);
		return this;
	}

	public IUuahDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll) {
		delegate.setIgnoredDefault(ignoreAll);
		return this;
	}

}
